namespace ext.tree
{
	using System;
	using System.Runtime.CompilerServices;
	using System.Html;
	using System.Collections;
	
	
	/// <summary>
	/// A TreeLoader provides for lazy loading of an {@link Ext.tree.TreeNode}&apos;s child
	/// nodes from a specified URL. The response must be a JavaScript Array definition
	/// whose elements are node definition objects. e.g.:
	/// 
	/// [{
	/// id: 1,
	/// text: &apos;A leaf Node&apos;,
	/// leaf: true
	/// },{
	/// id: 2,
	/// text: &apos;A folder Node&apos;,
	/// children: [{
	/// id: 3,
	/// text: &apos;A child Node&apos;,
	/// leaf: true
	/// }]
	/// }]
	/// </summary>
	/// <htmlSummary>
	/// A TreeLoader provides for lazy loading of an {@link Ext.tree.TreeNode}&apos;s child
	/// nodes from a specified URL. The response must be a JavaScript Array definition
	/// whose elements are node definition objects. e.g.:
	/// &lt;pre&gt;&lt;code&gt;
	/// [{
	/// id: 1,
	/// text: &apos;A leaf Node&apos;,
	/// leaf: true
	/// },{
	/// id: 2,
	/// text: &apos;A folder Node&apos;,
	/// children: [{
	/// id: 3,
	/// text: &apos;A child Node&apos;,
	/// leaf: true
	/// }]
	/// }]
	/// &lt;/code&gt;&lt;/pre&gt;
	/// &lt;br&gt;&lt;br&gt;
	/// A server request is sent, and child nodes are loaded only when a node is expanded.
	/// The loading node&apos;s id is passed to the server under the parameter name &quot;node&quot; to
	/// enable the server to produce the correct child nodes.
	/// &lt;br&gt;&lt;br&gt;
	/// To pass extra parameters, an event handler may be attached to the &quot;beforeload&quot;
	/// event, and the parameters specified in the TreeLoader&apos;s baseParams property:
	/// &lt;pre&gt;&lt;code&gt;
	/// myTreeLoader.on(&quot;beforeload&quot;, function(treeLoader, node) {
	/// this.baseParams.category = node.attributes.category;
	/// }, this);
	/// &lt;/code&gt;&lt;/pre&gt;
	/// This would pass an HTTP parameter called &quot;category&quot; to the server containing
	/// the value of the Node&apos;s &quot;category&quot; attribute.
	/// </htmlSummary>
	/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
	[ScriptName("TreeLoader")]
	[ScriptNamespace("Ext.tree")]
	[Imported()]
	public partial class TreeLoader : ext.util.Observable
	{
		
		#region Constructors
		/// <summary>Constructor</summary>
		/// <param name="config">A config object containing config properties.</param>
		public TreeLoader(ext.tree.TreeLoader_Configuration config)
		{
		}
		
		/// <summary>Constructor</summary>
		public TreeLoader()
		{
		}
		#endregion
		
		#region Fields
		/// <summary>Fires before a network request is made to retrieve the Json text which specifies a node&apos;s children.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("beforeloadEventName")]
		public const string BeforeloadEventName = "beforeload";
		
		/// <summary>Fires when the node has been successfuly loaded.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("loadEventName")]
		public const string LoadEventName = "load";
		
		/// <summary>Fires if the network request failed.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("loadexceptionEventName")]
		public const string LoadexceptionEventName = "loadexception";
		
		/// <summary>
		/// The URL from which to request a Json string which
		/// specifies an array of node definition objects representing the child nodes
		/// to be loaded.
		/// </summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("dataUrl")]
		public string DataUrl;
		
		/// <summary>The HTTP request method for loading data (defaults to the value of {@link Ext.Ajax#method}).</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("requestMethod")]
		public string RequestMethod;
		
		/// <summary>Equivalent to {@link #dataUrl}.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("url")]
		public string Url;
		
		/// <summary>If set to true, the loader recursively loads &quot;children&quot; attributes when doing the first load on nodes.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("preloadChildren")]
		public bool PreloadChildren;
		
		/// <summary>
		/// An object containing properties which
		/// specify HTTP parameters to be passed to each request for child nodes.
		/// </summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		/// <optional>Optional Field</optional>
		[ScriptName("baseParams")]
		public object BaseParams;
		
		/// <summary>
		/// An object containing attributes to be added to all nodes
		/// created by this loader. If the attributes sent by the server have an attribute in this object,
		/// they take priority.
		/// </summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		/// <optional>Optional Field</optional>
		[ScriptName("baseAttrs")]
		public object BaseAttrs;
		
		/// <summary>
		/// An object containing properties which
		/// specify custom {@link Ext.tree.TreeNodeUI} implementations. If the optional
		/// uiProvider attribute of a returned child node is a string rather
		/// than a reference to a TreeNodeUI implementation, then that string value
		/// is used as a property name in the uiProviders object.
		/// </summary>
		/// <htmlSummary>
		/// An object containing properties which
		/// specify custom {@link Ext.tree.TreeNodeUI} implementations. If the optional
		/// &lt;i&gt;uiProvider&lt;/i&gt; attribute of a returned child node is a string rather
		/// than a reference to a TreeNodeUI implementation, then that string value
		/// is used as a property name in the uiProviders object.
		/// </htmlSummary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		/// <optional>Optional Field</optional>
		[ScriptName("uiProviders")]
		public object UiProviders;
		
		/// <summary>
		/// Default to true. Remove previously existing
		/// child nodes before loading.
		/// </summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		/// <optional>Optional Field</optional>
		[ScriptName("clearOnLoad")]
		public bool ClearOnLoad;
		
		/// <summary>
		/// Defaults to undefined. Only used when using directFn.
		/// Specifies the params in the order in which they must be passed to the server-side Direct method
		/// as either (1) an Array of String values, or (2) a String of params delimited by either whitespace,
		/// comma, or pipe. For example,
		/// any of the following would be acceptable: 
		/// nodeParameter: &apos;node&apos;,
		/// paramOrder: [&apos;param1&apos;,&apos;param2&apos;,&apos;param3&apos;]
		/// paramOrder: &apos;node param1 param2 param3&apos;
		/// paramOrder: &apos;param1,node,param2,param3&apos;
		/// paramOrder: &apos;param1|param2|param|node&apos;
		/// </summary>
		/// <htmlSummary>
		/// Defaults to &lt;tt&gt;undefined&lt;/tt&gt;. Only used when using directFn.
		/// Specifies the params in the order in which they must be passed to the server-side Direct method
		/// as either (1) an Array of String values, or (2) a String of params delimited by either whitespace,
		/// comma, or pipe. For example,
		/// any of the following would be acceptable:&lt;pre&gt;&lt;code&gt;
		/// nodeParameter: &apos;node&apos;,
		/// paramOrder: [&apos;param1&apos;,&apos;param2&apos;,&apos;param3&apos;]
		/// paramOrder: &apos;node param1 param2 param3&apos;
		/// paramOrder: &apos;param1,node,param2,param3&apos;
		/// paramOrder: &apos;param1|param2|param|node&apos;
		/// &lt;/code&gt;&lt;/pre&gt;
		/// </htmlSummary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("paramOrder")]
		public ext.auto.System_String_Or_System_Array ParamOrder;
		
		/// <summary>
		/// Only used when using directFn.
		/// Send parameters as a collection of named arguments (defaults to false). Providing a
		/// {@link #paramOrder} nullifies this configuration.
		/// </summary>
		/// <htmlSummary>
		/// Only used when using directFn.
		/// Send parameters as a collection of named arguments (defaults to &lt;tt&gt;false&lt;/tt&gt;). Providing a
		/// &lt;tt&gt;{@link #paramOrder}&lt;/tt&gt; nullifies this configuration.
		/// </htmlSummary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("paramsAsHash")]
		public bool ParamsAsHash;
		
		/// <summary>
		/// The name of the parameter sent to the server which contains
		/// the identifier of the node. Defaults to &apos;node&apos;.
		/// </summary>
		/// <htmlSummary>
		/// The name of the parameter sent to the server which contains
		/// the identifier of the node. Defaults to &lt;tt&gt;&apos;node&apos;&lt;/tt&gt;.
		/// </htmlSummary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("nodeParameter")]
		public string NodeParameter;
		
		/// <summary>Function to call when executing a request.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("directFn")]
		public System.Delegate DirectFn;
		#endregion
		
		#region Methods
		/// <summary>
		/// Load an {@link Ext.tree.TreeNode} from the URL specified in the constructor.
		/// This is called automatically when a node is expanded, but may be used to reload
		/// a node (or append new children if the {@link #clearOnLoad} option is false.)
		/// </summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		/// <param name="node"></param>
		/// <param name="callback">
		/// Function to call after the node has been loaded. The
		/// function is passed the TreeNode which was requested to be loaded.
		/// </param>
		/// <param name="scope">
		/// The scope (<c>this</c> reference) in which the callback is executed.
		/// defaults to the loaded TreeNode.
		/// </param>
		[ScriptName("load")]
		public void LoadMethod(ext.tree.TreeNode node, System.Delegate callback, object scope)
		{
			throw new System.Exception("Imported - not implemented");
		}
		
		/// <summary>
		/// Override this function for custom TreeNode node implementation, or to
		/// modify the attributes at creation time. 
		/// Example: 
		/// new Ext.tree.TreePanel({
		/// ...
		/// loader: new Ext.tree.TreeLoader({
		/// url: &apos;dataUrl&apos;,
		/// createNode: function(attr) {
		/// // Allow consolidation consignments to have
		/// // consignments dropped into them.
		/// if (attr.isConsolidation) {
		/// attr.iconCls = &apos;x-consol&apos;,
		/// attr.allowDrop = true;
		/// }
		/// return Ext.tree.TreeLoader.prototype.createNode.call(this, attr);
		/// }
		/// }),
		/// ...
		/// });
		/// </summary>
		/// <htmlSummary>
		/// &lt;p&gt;Override this function for custom TreeNode node implementation, or to
		/// modify the attributes at creation time.&lt;/p&gt;
		/// Example:&lt;pre&gt;&lt;code&gt;
		/// new Ext.tree.TreePanel({
		/// ...
		/// loader: new Ext.tree.TreeLoader({
		/// url: &apos;dataUrl&apos;,
		/// createNode: function(attr) {
		/// // Allow consolidation consignments to have
		/// // consignments dropped into them.
		/// if (attr.isConsolidation) {
		/// attr.iconCls = &apos;x-consol&apos;,
		/// attr.allowDrop = true;
		/// }
		/// return Ext.tree.TreeLoader.prototype.createNode.call(this, attr);
		/// }
		/// }),
		/// ...
		/// });
		/// &lt;/code&gt;&lt;/pre&gt;
		/// </htmlSummary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		/// <param name="attr">The attributes from which to create the new node.</param>
		[ScriptName("createNode")]
		public void CreateNode(object attr)
		{
			throw new System.Exception("Imported - not implemented");
		}
		#endregion
		
		#region Events
		/// <summary>Fires before a network request is made to retrieve the Json text which specifies a node&apos;s children.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("beforeload")]
		public event ext.auto.Delegate_System_Object_And_System_Object_And_System_Object Beforeload;
		
		/// <summary>Fires when the node has been successfuly loaded.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("load")]
		public event ext.auto.Delegate_System_Object_And_System_Object_And_System_Object Load;
		
		/// <summary>Fires if the network request failed.</summary>
		/// <definedin>src\widgets\tree\TreeLoader.js</definedin>
		[ScriptName("loadexception")]
		public event ext.auto.Delegate_System_Object_And_System_Object_And_System_Object Loadexception;
		#endregion
	}
}
